﻿package frEngine.animateControler.cylinderControler
{
    import __AS3__.vec.*;
    import flash.events.*;
    import frEngine.*;
    import frEngine.animateControler.*;
    import frEngine.animateControler.keyframe.*;
    import frEngine.event.*;
    import frEngine.shader.filters.*;
    import frEngine.shader.registType.*;

    public class CylinderControlerBase extends MeshAnimateBase
    {
        protected var params:Vector.<Number>;

        public function CylinderControlerBase()
        {
            this.params = new Vector.<Number>(4, true);
            return;
        }// end function

        override public function get type() : int
        {
            throw new Error("请覆盖type方法！");
        }// end function

        override protected function setSurfaceHander(event:Event) : void
        {
            super.setSurfaceHander(event);
            if (targetMesh.material.materialParams.vertexFilterType == FilterType.CylinderVertexFilter)
            {
                this.reBuilderHander(null);
            }
            FrEventDispatcher.instance.proxyAddEventListener(targetMesh.material, Engine3dEventName.MATERIAL_REBUILDER, this.reBuilderHander);
            return;
        }// end function

        protected function reBuilderHander(event:Event) : void
        {
            var _loc_2:* = targetMesh.material.getParam("{params}", true);
            if (_loc_2)
            {
                this.params = _loc_2.value;
            }
            return;
        }// end function

        override public function dispose(param1:Boolean = true) : void
        {
            var _loc_4:FilterBase = null;
            FrEventDispatcher.instance.proxyRemoveEventListener(targetMesh.material, Engine3dEventName.MATERIAL_REBUILDER, this.reBuilderHander);
            var _loc_2:* = targetMesh.hasControler(AnimateControlerType.CylinderUpRadiusControler);
            var _loc_3:* = targetMesh.hasControler(AnimateControlerType.CylinderDownRadiusControler);
            if (_loc_2 && _loc_3)
            {
            }
            else
            {
                _loc_4 = targetMesh.material.materialParams.getFilterByTypeId(FilterType.CylinderVertexFilter);
                targetMesh.material.materialParams.removeFilte(_loc_4);
            }
            super.dispose();
            return;
        }// end function

    }
}
